<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

use Webman\Route;



//主应用路由
Route::group('/', function () {
    Route::get('index',[app\controller\IndexController::class, 'index']);
});

//api应用路由
Route::group('/api/', function () {
    Route::get('index',[app\controller\IndexController::class, 'index']);
    Route::post('upload/image', [app\api\controller\UploadController::class, 'image']);
    Route::post('upload/file', [app\api\controller\UploadController::class, 'file']);
    Route::post('login', [app\api\controller\LoginController::class, 'wxLogin']);

    //提交订单
    Route::post('order', [app\api\controller\TaskController::class, 'create']);
    
    Route::group('system/', function () {
        //轮播图
        Route::get('banner', [app\api\controller\SystemController::class, 'banner']); 
        //首页模板信息
        Route::get('index', [app\api\controller\SystemController::class, 'indexTemplate']);
        //所有模板分类
        Route::get('type', [app\api\controller\SystemController::class, 'templateType']);
        //指定分类下的模板
        Route::get('type/{id}', [app\api\controller\SystemController::class, 'template']);
        //指定模板的价格
        Route::get('type/price/{id}', [app\api\controller\SystemController::class, 'templatePrice']);
        //用户签到
        Route::get('sign', [app\api\controller\SystemController::class, 'sign']);
        //用户信息
        Route::get('user', [app\api\controller\UserController::class, 'userInfo']);
        //修改用户资料
        Route::post('user', [app\api\controller\UserController::class, 'profile']);
        //VIP价格列表
        Route::get('vip', [app\api\controller\SystemController::class, 'vipPrice']);
        //每日任务列表
        Route::get('task', [app\api\controller\SystemController::class, 'task']);
        //获取充值档位
        Route::get('recharge', [app\api\controller\SystemController::class, 'recharge']);
        //首页查看用户分享信息
        Route::get('share', [app\api\controller\SystemController::class, 'share']);
        //获取首页热门的模板
        Route::get('recommend', [app\api\controller\SystemController::class, 'recommend']);
    });
    
    Route::group('user/', function () {
        //获取用户的任务队列
        Route::get('task', [app\api\controller\UserController::class, 'task']);
        //获取用户已经完成的任务相册
        Route::get('photo', [app\api\controller\UserController::class, 'photo']);
        //点赞接口
        Route::post('like', [app\api\controller\UserController::class, 'like']);
    });
    
    Route::group('console/', function () {
        //会员到期脚本
        Route::get('levelEndtime', [app\api\controller\ConsoleController::class, 'levelEndtime']);
    });
});

Route::fallback(function(){
    return json(['code' => 404, 'msg' => '404 not found']);
});
Route::disableDefaultRoute('', 'api');


